package task08;

import java.util.HashSet;
import java.util.Iterator;

public class HashSetTest {
    public static void main(String[] args) {

        HashSet<Student> studentHashSet=new HashSet<Student>();
        Student student1=new Student("rose",18);
        Student student2=new Student("rose",18);
        Student student3=new Student("rose",20);
        studentHashSet.add(student1);
        studentHashSet.add(student2);
        studentHashSet.add(student3);

        Iterator iterator=studentHashSet.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }









        /*HashSet<String> stringHashSet=new HashSet<String>();
        stringHashSet.add("张三");
        stringHashSet.add("李四");
        stringHashSet.add("Lily");
        stringHashSet.add("Lily");*/

        /*Iterator iterator=stringHashSet.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }*/

    }
}
